package com.manbu.live.api.controller;


import com.manbu.live.user.dto.UserDTO;
import com.manbu.live.user.inerface.IUserRpc;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author hanWang
 * @Title:
 * @Package
 * @Description:
 * @date 2024/1/87:56 上午
 */
@RestController
@RequestMapping("/user")
public class UserController {
    // 远程rpc 引入
    @DubboReference
    private IUserRpc iUserRpc;


    @GetMapping("/getUserInfo")
    public UserDTO getUserInfo(@RequestParam("userId") Long userId){

        return iUserRpc.getByUserId(userId);
    }
    @DeleteMapping("/deleteUserById")
    public Boolean deleteUserById(@RequestParam("userId") Long userId){

        return iUserRpc.deleteUserById(userId);
    }
    @PostMapping("/updateUserById")
    public Boolean updateUserById(@RequestBody UserDTO userDTO){

        return iUserRpc.updateUserById(userDTO);
    }
    @PostMapping("/saveUser")
    public Boolean saveUser(@RequestBody UserDTO userDTO){

        return iUserRpc.saveUser(userDTO);
    }
    @PostMapping("/bathQueryUserInfo")
    public Map<Long,UserDTO> bathQueryUserInfo(@RequestBody List<Long> userIdList){

        return iUserRpc.bathQueryUserInfo(userIdList);
    }


}
